

******************************************************
***************** TABLE A.4 *******************

use "${ddata}cleaned_data_wACSweight.dta", clear


** female stats ***

forvalues i = 0/5 { 
	sum qs2_`i' [aw=weight_ACS] if control==1 & qs2_`i'!=.&male==0
	local f_sd_fo_`i' = "`: di %3.2f r(sd)'" 
	local f_mean_fo_`i' = "`: di %3.2f r(mean)'" 
	local f_n_`i' = "`: di %3.0f r(N)'" 

}

forvalues i = 0/5 { 
	sum so_mother_time_off_`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==0
	local f_sd_so_`i' = "`: di %3.2f r(sd)'" 
	local f_mean_so_`i' = "`: di %3.2f r(mean)'" 
}


forvalues i = 0/5 { 
	sum so_less_fo`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==0
	local f_mean_so_less_`i' = "`: di %3.2f r(mean)'" 
	sum so_gap_positive_`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==0
	local f_mean_gap_positive_`i' = "`: di %3.2f r(mean)'" 
}


forvalues i = 0/5 { 
	reg so_gap_positive_`i' [aweight=weight_ACS] if control==1&male==0
	test _cons=0.5 
	gen f_p`i' = r(p) if control==1 & so_gap_positive_`i'!=.
	sum f_p`i' 
	local f_mean_p_`i' = "`: di %3.2f r(mean)'" 

}



** male stats ***

forvalues i = 0/5 { 
	sum qs2_`i' [aw=weight_ACS] if control==1 & qs2_`i'!=.&male==1
	local m_sd_fo_`i' = "`: di %3.2f r(sd)'" 
	local m_mean_fo_`i' = "`: di %3.2f r(mean)'" 
	local m_n_`i' = "`: di %3.0f r(N)'" 

}

forvalues i = 0/5 { 
	sum so_mother_time_off_`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==1
	local m_sd_so_`i' = "`: di %3.2f r(sd)'" 
	local m_mean_so_`i' = "`: di %3.2f r(mean)'" 
}


forvalues i = 0/5 { 
	sum so_less_fo`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==1
	local m_mean_so_less_`i' = "`: di %3.2f r(mean)'" 
	sum so_gap_positive_`i' [aw=weight_ACS] if control==1 & so_mother_time_off_`i'!=.&male==1
	local m_mean_gap_positive_`i' = "`: di %3.2f r(mean)'" 
}


forvalues i = 0/5 { 
	reg so_gap_positive_`i' [aweight=weight_ACS] if control==1&male==1
	test _cons=0.5 
	gen m_p`i' = r(p) if control==1 & so_gap_positive_`i'!=.
	sum m_p`i' 
	local m_mean_p_`i' = "`: di %3.2f r(mean)'" 

}


cap file close table
file open table using "${o}TableA4_ACSweighted.tex", write replace	
file write table "\centering" _n	
file write table "\begin{tabular}{lcccccc}" _n
file write table "\toprule" _n
file write table "\multicolumn{2}{c}{\textbf{Panel A: Women }}\\ " _n
file write table "\midrule" _n
file write table "&\multirow{1}{*}{Mother}&\multicolumn{5}{c}{Mother Takes Time off if she earns [...] than spouse}\\ "_n
file write table "\cline{3-7} &\multicolumn{1}{c}{Reject Offer}&\multicolumn{1}{c}{15\% Less}&\multicolumn{1}{c}{Same}&\multicolumn{1}{c}{15\% More}&\multicolumn{1}{c}{30\% More}&\multicolumn{1}{c}{50\% More}\\" _n
file write table "\midrule" _n
file write table "First-Order Beliefs (FO)& `f_mean_fo_0'&      `f_mean_fo_1'&       `f_mean_fo_2'&       `f_mean_fo_3'&      `f_mean_fo_4'&       `f_mean_fo_5'\\" _n
file write table  " &       (`f_sd_fo_0')&       (`f_sd_fo_1')&       (`f_sd_fo_2')&       (`f_sd_fo_3')&       (`f_sd_fo_4')&       (`f_sd_fo_5')\\" _n
file write table "Second-Order Beliefs (FO)&        `f_mean_so_0'&      `f_mean_so_1'&       `f_mean_so_2'&       `f_mean_so_3'&      `f_mean_so_4'&       `f_mean_so_5'\\" _n
file write table "&       (`f_sd_so_0')&       (`f_sd_so_1')&       (`f_sd_so_2')&       (`f_sd_so_3')&       (`f_sd_so_4')&       (`f_sd_so_5')\\" _n
file write table "Share SO $<$ FO         &        `f_mean_so_less_0'&      `f_mean_so_less_1'&       `f_mean_so_less_2'&       `f_mean_so_less_3'&      `f_mean_so_less_4'&       `f_mean_so_less_5'\\" _n
file write table "Share SO $>$ truth      &        `f_mean_gap_positive_0'&      `f_mean_gap_positive_1'&       `f_mean_gap_positive_2'&       `f_mean_gap_positive_3'&      `f_mean_gap_positive_4'&       `mean_gap_positive_5'\\" _n
file write table "P-value: Share SO $>$ truth = 0.5 &        `f_mean_p_0'&        `f_mean_p_1'&        `f_mean_p_2'&        `f_mean_p_3'&        `f_mean_p_4'&        `f_mean_p_5'\\" _n
file write table "\midrule" _n
file write table "Observations        &        `f_n_0'&        `f_n_1'&        `f_n_2'&        `f_n_3'&        `f_n_4'&        `f_n_5'\\" _n
file write table "\toprule" _n
file write table "\multicolumn{2}{c}{\textbf{Panel B: Men }}\\" _n
file write table "\midrule" _n
file write table "&\multirow{1}{*}{Mother}&\multicolumn{5}{c}{Mother Takes Time off if she earns [...] than spouse}\\" _n
file write table "\cline{3-7} &\multicolumn{1}{c}{Reject Offer}&\multicolumn{1}{c}{15\% Less}&\multicolumn{1}{c}{Same}&\multicolumn{1}{c}{15\% More}&\multicolumn{1}{c}{30\% More}&\multicolumn{1}{c}{50\% More}\\" _n
file write table "\midrule" _n
file write table "First-Order Beliefs (FO)&        `m_mean_fo_0'&      `m_mean_fo_1'&       `m_mean_fo_2'&       `m_mean_fo_3'&      `m_mean_fo_4'&       `m_mean_fo_5'\\" _n
file write table "&       (`m_sd_fo_0')&       (`m_sd_fo_1')&       (`m_sd_fo_2')&       (`m_sd_fo_3')&       (`m_sd_fo_4')&       (`m_sd_fo_5')\\" _n
file write table "Second-Order Beliefs (FO)&        `m_mean_so_0'&      `m_mean_so_1'&       `m_mean_so_2'&       `m_mean_so_3'&      `m_mean_so_4'&       `m_mean_so_5'\\" _n
file write table "&       (`m_sd_so_0')&       (`m_sd_so_1')&       (`m_sd_so_2')&       (`m_sd_so_3')&       (`m_sd_so_4')&       (`m_sd_so_5')\\" _n
file write table "Share SO $<$ FO         &        `m_mean_so_less_0'&      `m_mean_so_less_1'&       `m_mean_so_less_2'&       `m_mean_so_less_3'&      `m_mean_so_less_4'&       `m_mean_so_less_5'\\" _n
file write table "Share SO $>$ truth      &        `m_mean_gap_positive_0'&      `m_mean_gap_positive_1'&       `m_mean_gap_positive_2'&       `m_mean_gap_positive_3'&      `m_mean_gap_positive_4'&       `mean_gap_positive_5'\\" _n
file write table "P-value: Share SO $>$ truth = 0.5 &        `m_mean_p_0'&        `m_mean_p_1'&        `m_mean_p_2'&        `m_mean_p_3'&        `m_mean_p_4'&        `m_mean_p_5'\\" _n
file write table "\midrule" _n
file write table "Observations        &        `m_n_0'&        `m_n_1'&        `m_n_2'&        `m_n_3'&        `m_n_4'&        `m_n_5'\\" _n
file write table "\bottomrule" _n
file write table "\end{tabular}" _n
cap file close table
